<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateNotification extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasTable('notification')) {
            return;
        }

        Schema::create('notification', function (Blueprint $table) {
            $table->id();
            $table->string('cid')->default('')->comment('客户端ID');
            $table->string('platform')->default('')->comment('客户端类型');
            $table->unsignedInteger('user_id')->default(0)->comment('接受通知的用户ID');
            $table->string('title')->default('')->comment('通知标题');
            $table->unsignedInteger('business_id')->default(0)->comment('业务ID');
            $table->string('business_type')->default('')->comment('业务类型');
            $table->text('content')->comment('通知内容');
            $table->unsignedInteger('create_user_id')->default(0)->comment('通知发起人ID');
            $table->unsignedTinyInteger('status')->default(0)->comment('状态: 已读|未读');
            $table->integer('create_time')->nullable();
            $table->integer('update_time')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
    }
}
